// 定义请求的函数
import type { PageResult } from '@/types/global'
import type {
  BannerItem,
  CategoryItem,
  GuessItem,
  HotItem,
  ParamsType
} from '@/types/home'
import { http } from '@/utils/request'

/**
 * 首页-广告区域
 * @param distributionSite 广告区域展示位置 1 为首页（默认值） 2 为商品分类页
 */
export const getHomeBannerAPI = (distributionSite = 1) => {
  return http<BannerItem[]>({
    url: '/home/banner',
    method: 'GET',
    data: {
      distributionSite
    }
  })
}

/**
 * 首页-前台分类
 */
export const getHomeCategoryPanelAPI = () => {
  return http<CategoryItem[]>({
    url: '/home/category/mutli',
    method: 'GET'
  })
}

/**
 * 首页-热门推荐
 */
export const getHotPanelAPI = () => {
  return http<HotItem[]>({
    url: '/home/hot/mutli',
    method: 'GET'
  })
}

/**
 * 猜你喜欢-小程序
 */
export const getHomeGoodsGuessLikeAPI = (data: ParamsType) => {
  return http<PageResult<GuessItem>>({
    url: '/home/goods/guessLike',
    method: 'GET',
    data
  })
}
